package com.jt;

import com.jt.config.SpringConfig;
import com.jt.controller.UserController;
import com.jt.pojo.User;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class test01 {
    @Test
    public void test(){
        ApplicationContext context=
                new ClassPathXmlApplicationContext("application.xml");
        UserController userController = (com.jt.controller.UserController) context.getBean("userController");
       userController.addUser();
    }
    @Test
    public void testAnno(){
        ApplicationContext context=
                new AnnotationConfigApplicationContext(SpringConfig.class);
        UserController userController = (UserController) context.getBean("userController");
        userController.addUser();
    }
}

